<?php
namespace EM\NewsBundle\Form;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Doctrine\ORM\EntityRepository;

class UserGeoLangSettingsType extends AbstractType
{
    public function buildForm(FormBuilderInterface $builder, array $options)
    {
     //   $builder->add('lang', 'entity', array( 'label' => 'Languages', 'required' => true, 'multiple' => true,'expanded'=>false, 'class' => 'EMNewsBundle:Languages','property' => 'name'));
        $builder->add('geo', 'entity', array( 'empty_value' => 'Choose an option','label' => 'Country', 
            'required' => true, 'multiple' => false,'expanded'=>false, 
            'class' => 'EMNewsBundle:Geography','query_builder' => function(EntityRepository $er) {
            return $er->createQueryBuilder('u')->where('u.level = 2');
    },'property' => 'name'));
    }
    public function getName()
    {
        return 'lang_form';
    }
}